home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
math
/
nrpas13
/
factln.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-04-29
|
528b
|
18 lines
FUNCTION factln(n: integer): real;
(* Programs using routine FACTLN must declare the array
VAR
gla: ARRAY [1..100] OF real;
and must initialize the array to the values
FOR i := 1 TO 100 DO gla[i] := -1.0;
in the main routine. *)
BEGIN
IF (n < 0) THEN BEGIN
writeln ('pause in FACTLN - negative factorial'); readln END
ELSE IF (n <= 99) THEN BEGIN
IF (gla[n+1] < 0.0) THEN gla[n+1] := gammln(n+1.0);
factln := gla[n+1] END
ELSE BEGIN
factln := gammln(n+1.0)
END
END;